package com.example.controller;

import com.example.pojo.User;
import com.example.result.ResponseResult;
import com.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yangjicong
 * @date 2022/3/3
 *
 * http://localhost:8080/api/v1/channel/1
 */
@RestController
@RequestMapping("/api/v1/channel")
public class UserController {
	@Autowired
	private UserService UserService;

	@GetMapping("/{id}")
	public ResponseResult<User> findUserById(@PathVariable("id") Integer id) {
		return ResponseResult.okResult(UserService.getUser(id));
	}

	@GetMapping("/login")
	public ResponseResult<User> findUserById() {
		return ResponseResult.okResult("登陆成功");
	}


}
